home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / PPCSmallEiffel / lib_se / run_feature_2.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  3.8 KB  |  167 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class RUN_FEATURE_2
  17.    
  18. inherit RUN_FEATURE redefine base_feature, address_of end;
  19.    
  20. creation {WRITABLE_ATTRIBUTE} make
  21.    
  22. feature 
  23.    
  24.    base_feature: WRITABLE_ATTRIBUTE;
  25.    
  26.    local_vars: LOCAL_VAR_LIST is do end;
  27.    
  28.    is_static: BOOLEAN is do end;
  29.    
  30.    static_value_mem: INTEGER is do end;
  31.  
  32.    can_be_dropped: BOOLEAN is true;
  33.    
  34.    is_pre_computable: BOOLEAN is false;
  35.  
  36.    afd_check is 
  37.       local
  38.      rc: RUN_CLASS;
  39.       do 
  40.      rc := result_type.run_type.run_class;
  41.       end;
  42.    
  43.    mapping_c is
  44.       local
  45.      ct: TYPE;
  46.       do
  47.      ct := current_type;
  48.      if ct.is_basic_eiffel_expanded then
  49.         check
  50.            us_item = name.to_string 
  51.         end;
  52.         cpp.put_target_as_value;
  53.      else
  54.         cpp.put_character('(');
  55.         if ct.is_reference then
  56.            cpp.put_character('(');
  57.            ct.mapping_cast;
  58.            cpp.put_target_as_target;
  59.            cpp.put_character(')');
  60.            cpp.put_string(fz_b5);
  61.         else
  62.            cpp.put_target_as_value;
  63.            cpp.put_string(")._");
  64.         end;
  65.         cpp.put_string(name.to_string);
  66.         force_c_recompilation_comment;
  67.      end;
  68.       end;
  69.  
  70.    address_of is
  71.       do
  72.      cpp.put_string("&(C->_");
  73.      cpp.put_string(name.to_string);
  74.      cpp.put_character(')');
  75.       end;
  76.    
  77.    c_define is 
  78.       do
  79.      nothing_comment;
  80.       end;
  81.    
  82. feature {NONE}   
  83.    
  84.    force_c_recompilation_comment is
  85.       local
  86.      rc: RUN_CLASS;
  87.       do
  88.      cpp.put_string(fz_open_c_comment);
  89.      rc := run_class;
  90.      cpp.put_integer(rc.offset_of(Current));
  91.      cpp.put_string(fz_close_c_comment);
  92.       end;
  93.    
  94.    initialize is
  95.       do
  96.      result_type := base_feature.result_type.to_runnable(current_type);
  97.       end;
  98.    
  99.    compute_use_current is
  100.       do
  101.      use_current_state := ucs_true;
  102.       end;
  103.  
  104. feature {RUN_CLASS}
  105.  
  106.    jvm_field_or_method is
  107.       do
  108.      jvm.add_field(Current);
  109.       end;
  110.  
  111. feature
  112.  
  113.    mapping_jvm is
  114.       local
  115.      idx: INTEGER;
  116.      stack_level: INTEGER;
  117.       do
  118.      jvm.push_target_as_target;
  119.      stack_level := result_type.jvm_stack_space - 1;
  120.      idx := constant_pool.idx_fieldref(Current);
  121.      code_attribute.opcode_getfield(idx,stack_level);
  122.       end;
  123.  
  124. feature {JVM}
  125.  
  126.    jvm_define is
  127.       local
  128.      name_idx, descriptor: INTEGER;
  129.      cp: like constant_pool;
  130.       do
  131.      cp := constant_pool;
  132.      name_idx := cp.idx_uft8(name.to_string);
  133.      descriptor := cp.idx_uft8(jvm_descriptor);
  134.      field_info.add(1,name_idx,descriptor);
  135.       end;
  136.    
  137. feature {NONE}
  138.  
  139.    update_tmp_jvm_descriptor is
  140.       local
  141.      rt: TYPE;
  142.       do
  143.      rt := result_type.run_type;
  144.      if rt.is_reference then
  145.         tmp_jvm_descriptor.append(jvm_root_descriptor);
  146.      else
  147.         rt.jvm_descriptor_in(tmp_jvm_descriptor);
  148.      end;
  149.       end;
  150.  
  151. invariant
  152.    
  153.    arguments = Void;
  154.    
  155.    result_type /= Void;
  156.    
  157.    require_assertion = Void;
  158.    
  159.    routine_body = Void;
  160.    
  161.    ensure_assertion = Void;
  162.    
  163.    rescue_compound = Void;
  164.    
  165. end -- RUN_FEATURE_2
  166.  
  167.